<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建任务</title>
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link rel="stylesheet" href="/Public/css/toast.css">
    <link rel="stylesheet" href="/Public/css/gxxjkefu-normalize.css">
    <link rel="stylesheet" href="/Public/css/model.css">
    <link rel="stylesheet" type="text/css" href="/Public/css/xcConfirm.css"/>
    <script src="/Public/js/jquery-3.2.1.js"></script>
    <script src="/Public/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
    <script src="/Public/laydate/laydate.js"></script>

    <style>
        .found_info{
            padding: 4% 5% 15%;
            line-height: 35px;
            color: black;
            background: #ffffff;
        }
        .found_info p{
            font-size:17px;
        }
        .found_info input,select{
            padding: 10px 15px;
            background: #f5f5f5;
            border: none;
            color: #989898;
            margin-bottom: 30px;
        }
        .found_info select{
            width: 200px;
            height: 40px;
        }
        .found_info .found_info_user span{
            display: inline-block;
        }
        textarea{
            background: #f5f5f5;
            border: none;
            padding: 1%;
        }
        .remark_div{
            width:650px;
        }
        .remark_div input{
            float: right;
            background: #ff815a;
            border-radius: 3px;
            color: white;
            margin-top: 20px;
            width: 200px;
            height: 40px;
        }
    </style>

</head>
<body>
<div id="main_C" class="animated fadeInRight">
    <div class="title_info">
        <span>创建任务</span>
    </div>
    <ul class="white_bgColor found_info">
        <li>
            <p>任务名称</p>
            <input id="task_title" style="width: 620px" type="text" placeholder="单行输入"/>
        </li>
        <li>
            <p>指定时间</p>
            <input id="time_pick" placeholder="请输入日期" class="laydate-icon" onclick="laydate()">
        </li>
        <li>
            <p>指定人</p>
            <select name="" id="select_kefu" onchange="select_kf(this)">
                <option value="0" selected="true">本人</option>
                <volist name="data" id="vo">
                    <option value="<{$vo.id}>"><{$vo.name}></option>
                </volist>

            </select>
        </li>
        <li class="remark_div">
            <p>备注</p>
            <textarea name="a" id="remark" style="width:98%;height:210px;"></textarea>
            <input type="button" value="提交" onclick="submit_task()"/>
        </li>
    </ul>
</div>


<script src="/Public/js/jquery-3.2.1.js"></script>
<script src="/Public/js/toast.js"></script>

<script>

    var mobile="<{$mobile}>";
    console.log('12312321',mobile);
    //提交
 function submit_task() {
     var task_time = $("#time_pick").val();
     var task_title = $("#task_title").val();
     var select_kefu = $("#select_kefu").val();
     var remark = $("#remark").val();
     var url = "<{$SERVER_NAME}>/User/addTask";
     if (task_title == "" || task_title.replace(/(^s*)|(s*$)/g, "").length == 0) {
         $('#main_C').toast({
             content: '请填写任务名称！',
             duration: 1000
         });
//         window.wxc.xcConfirm('请填写任务名称', window.wxc.xcConfirm.typeEnum.info);
         return false;
     } else if (task_time == "" || task_time.replace(/(^s*)|(s*$)/g, "").length == 0) {
         $('#main_C').toast({
             content: '请选择任务时间！',
             duration: 1000
         });
//         window.wxc.xcConfirm('请选择任务时间', window.wxc.xcConfirm.typeEnum.info);
         return false;
     }
     var txt = "确定提交？";
     var option = {
         title: "任务提交",
         btn: parseInt("0011", 2),
         onOk: function () {
             $.post(url, {
                 title: task_title,
                 task_time: task_time,
                 remark: remark,
                 mobile: mobile,
                 accept: select_kefu
             }, function (data) {
                 console.log('121212', data);
                 if (data.code == '1001') {
                       $("#time_pick").val("");
                       $("#task_title").val("");
                      $("#select_kefu").val(0);
                       $("#remark").val("");
                     var url = "<{$SERVER_NAME}>/User/addTask";
//                     window.wxc.xcConfirm(data.result, window.wxc.xcConfirm.typeEnum.success);
                     window.parent.get_task();
//                     window.location.reload();
                 } else {
                     window.wxc.xcConfirm(data.result, window.wxc.xcConfirm.typeEnum.success);
                 }
             });
         }

     }
     window.wxc.xcConfirm(txt, "custom", option);

 }
//    ;!function(){
//
////laydate.skin('molv');
//
//        laydate({
//            elem: '#demo'
//        })
//
//    }();
</script>

</body>
</html>